<?php
namespace Admin\Controller;
use app\admin\Model\Yunying;
// 后台用户模块
class YunyingController extends CommonController {
	
   /* public function index(){
       $yunying = new Yunying();
       $list = $yunying->select();
       echo 666;die();
       dump($list);die();
        $this->display();
    }*/
    public function outxls(){

	   $filename='用户列表';
       $map=$this->_search();
       
       if($_REQUEST ['ids']!='all'){
       	 $map['id'] = array('in', explode(',', $_REQUEST ['ids']));
       }
        $volist = D('User')->where($map)->field('nickname,account,create_time')->select();
       foreach ($volist as $key =>$vo){
			$volist[$key]['create_time']=date("Y-m-d",$vo['create_time']);
		}
		
		$headArr=array("名称","账号","创建日期");
    
		$this->xlsout($filename,$headArr,$volist);
        
		
    }

public function rolelist(){
	
	    $role = D("Role");

        $map=$this->_search('Role');
	    
	   
	    $map['status']=1;
	   
		$this->_list($role,$map);
		$this->display();
	
}
	public function add(){
		$admin_id = $_SESSION['zs_admin']['userid'];
		if ($admin_id == 1) {
			$dengji = 2;
		}else{
			$user = M('user')->where(array('id'=>$admin_id))->find();//当前用户
			if ($user['dengji'] == 2) {
				$dengji = 3;
			}
			if ($user['dengji'] == 3) {
				$dengji = 4;
			}
		}

		$this->assign('dengji',$dengji);
		$this->assign('admin_id',$admin_id);
		$this->display();
	}
	function edit() {
        $model = M('Yunying');
		$id = $_REQUEST [$model->getPk()];
		$vo = $model->getById($id);
		$this->assign('vo', $vo);
		$this->display();
	}



}

?>